/*
 * Copyright 2000 the original author or authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _WT_HTML_ENTITIES_H
#define _WT_HTML_ENTITIES_H

#include <tcl.h>

typedef enum {
  WT_ENT_DEFAULT        = 0x01,
  WT_ENT_ALL            = 0x02,
  WT_ENT_SPECIAL_CHARS  = 0x04,
  WT_ENT_DOUBLE_QUOTE   = 0x08,
  WT_ENT_SINGLE_QUOTE   = 0x10,
  WT_ENT_NAMED_ENTITIES = 0x20,
  WT_ENT_UNKNOWN_CHARS  = 0x40
} WtHtmlEncodingOption;

void WtInitHtmlEntities();
void WtDoInitHtmlEntities();
void WtDeleteHtmlEntities();
void WtDoDeleteHtmlEntities();
Tcl_Obj *WtEncodeHtml(const char *utfStr, int options);

typedef struct WtHtmlMaps {
  int initialized;
  char **charsToEnts;
  const int maxHtmlChar;
  Tcl_HashTable *entsToChars;
  Tcl_Mutex htmlLock;
} WtHtmlMaps;

extern WtHtmlMaps wtHtmlMaps;
extern int wtHtmlEntityChars[];
extern const char *wtHtmlEntityStrings[];


#endif /* ! _WT_HTML_ENTITIES_H */
